﻿#include<iostream>
#include<stack>
#include<queue>
#include<functional>

using std::cout;
using std::endl;
using namespace std;

#include "priority_queue.h"
#include "Queue.h"
#include "Stack.h"

void test_stack()
{
	ly::stack<int,std::vector<int>>st;
	st.push(1);
	st.push(2);
	st.push(3);
	st.push(4);
	st.push(5);

	while (!st.empty())
	{
		cout << st.top() << " ";
		st.pop();
	}
	cout << endl;

}

void test_queue()
{
	//std::queue<int> q;
	//bit::queue<int,list<int>> q;
	
	ly::queue<int> q;
	q.push(1);
	q.push(2);
	q.push(3);
	q.push(4);
	q.push(5);

	while (!q.empty())
	{
		cout << q.front()<<" ";
		q.pop();
	}
	cout << endl;
}

void test_priority_queue()
{
	//默认是一个大堆，默认大的优先级高less
	//std::priority_queue<int> pq;
	
	//变成小堆，小的优先级高用greater

	//std::priority_queue<int,vector<int>,std::greater<int>> pq;
	//默认时一个大堆，默认大的优先级高less

	//ly::priority_queue<int> pq;
	//变成小堆，小的优先级高怎么处理greater
	ly::priority_queue<int,vector<int>,ly::greater<int>> pq;

	pq.push(1);
	pq.push(2);
	pq.push(3);
	pq.push(4);
	pq.push(5);
	pq.push(6);
	pq.push(7);

	int k = 5;
	while (!pq.empty() && k--)
	{
		cout << pq.top() << " ";
		pq.pop();
	}
	cout << endl;

}

int main()
{
	test_stack();
	test_queue();
	test_priority_queue();
	return 0;
}